from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from test_app.views import TestCaseViewSet,TestReportViewSet
from django.http import HttpResponse


# 定义一个简单的首页视图
def home(request):
    return HttpResponse("""
    <h1>自动化测试平台后端</h1>
    <p>✅ 后端服务已启动！</p>
    <ul>
        <li><a href="/admin/">👉 管理后台</a></li>
        <li><a href="/api/test-cases/">👉 测试用例 API</a></li>
    </ul>
    """)


# router = DefaultRouter()
# router.register(r'test-cases', TestCaseViewSet)
# router.register(r'test-reports', TestReportViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', home, name='home'),  # 添加根路径
    path('api/', include('test_app.urls'))
]
